package xinxin.com.FlyweightPatternBasic;

import xinxin.com.FlyweightPatternBasic.Factory.FlyweightFactory;
import xinxin.com.FlyweightPatternBasic.Flyweight.Concrete.UnsharedConcreteFlyweight;
import xinxin.com.FlyweightPatternBasic.Flyweight.Flyweight;

/**
 * @author ：史鑫鑫
 * @date ：Created in 2019/4/2 21:26
 */
public class FlyweightPatternBasic {
    public static void main(String[] args) {
        int extrinsicstate = 22;

        FlyweightFactory factory = new FlyweightFactory();

        Flyweight fx = factory.GetFlyweight("X");
        fx.Operation(--extrinsicstate);

        Flyweight fy = factory.GetFlyweight("Y");
        fx.Operation(--extrinsicstate);

        Flyweight fz = factory.GetFlyweight("Z");
        fx.Operation(--extrinsicstate);

        UnsharedConcreteFlyweight uf = new UnsharedConcreteFlyweight();
        uf.Operation(--extrinsicstate);
    }
}
